//
//  YXInventoryView.m
//  跑跑快销
//
//  Created by 杨潇 on 14-5-5.
//  Copyright (c) 2014年 ylife. All rights reserved.
//

#import "YXInventoryView.h"

@implementation YXInventoryView
@synthesize segment,searchTf,updateBtn;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self.backgroundColor = [UIColor grayColor];
        
        segment = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"不使用库存",@"个人库存", nil]];
        segment.frame = CGRectMake(10, 20, 300, 40);
        segment.selectedSegmentIndex = 1;
        [self addSubview:segment];

        searchTf = [[UITextField alloc] initWithFrame:CGRectMake(10, segment.frame.origin.y + segment.frame.size.height + 10, 230, 40)];
        searchTf.placeholder = @"库存搜索";
        [searchTf addTarget:self action:@selector(down) forControlEvents:UIControlEventEditingDidEndOnExit];
        searchTf.borderStyle = UITextBorderStyleRoundedRect;
        [self addSubview:searchTf];
        
        updateBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        updateBtn.frame = CGRectMake(searchTf.frame.origin.x + searchTf.frame.size.width + 10, searchTf.frame.origin.y, 60, 40);
        [updateBtn setTitle:@"刷新" forState:UIControlStateNormal];
        updateBtn.backgroundColor = [UIColor whiteColor];
        updateBtn.layer.cornerRadius = 5;
        [self addSubview:updateBtn];
        
        NSArray * typeArr = [NSArray arrayWithObjects:@"货品",@"数量", nil];
        for (int i = 0; i < 2; i ++) {
            UILabel * typeLab = [[UILabel alloc] initWithFrame:CGRectMake(160 * i, updateBtn.frame.origin.y + updateBtn.frame.size.height + 5, 160, 25)];
            typeLab.tag = i + 10;
            typeLab.backgroundColor = [UIColor brownColor];
            typeLab.layer.borderColor = [UIColor blackColor].CGColor;
            typeLab.layer.borderWidth = .5;
            typeLab.textAlignment = NSTextAlignmentCenter;
            typeLab.text = [typeArr objectAtIndex:i];
            [self addSubview:typeLab];
        }
    }
    return self;
}

- (void)down
{
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
